import { createStore } from 'vuex'
import preorderModule from './modules/preorder'
import loadPreOrderDetails from './modules/loadPreOrderDetails'
import orderModule from './modules/order'
import adminModule from './modules/admin'
import loadOrderDetails from './modules/loadOrderDetails'
import queryPayStatus from './modules/payment'
import createPayPalOrder from './modules/createPayPalOrder'
import verifyPayment from './modules/verifyPayment'
import notifyCancellation from './modules/notifyCancellation'

// 导入其他模块
// import otherModule from './modules/otherModule'

export default createStore({
  state: {
    // 根级别的 state
  },
  getters: {
    // 根级别的 getters
  },
  mutations: {
    // 根级别的 mutations
  },
  actions: {
    // 根级别的 actions
  },
  modules: {
    preorder: preorderModule,
    // 注册其他模块
    loadPreOrderDetails: loadPreOrderDetails,
    createOrder: orderModule,
    loadOrderDetails: loadOrderDetails,
    queryPayStatus: queryPayStatus,
    createPayPalOrder: createPayPalOrder,
    verifyPayment: verifyPayment,
    notifyCancellation: notifyCancellation,
    fetchOrders: orderModule,
    fetchOrderDetails: orderModule,
    cancelOrder: orderModule,
    takeOrder: orderModule,
    refundOrder: orderModule,
    fetchDailyStats: adminModule,
    fetchRefundOrders: adminModule,
    orders: adminModule,
    updateSearchForm: adminModule,
    refundOrders: adminModule,
  }
})
